import request from '@/utils/request'

// 登录
export function fetchTree(listQuery, scope) {
  return request({
    url: `/kd_manage/menu/${scope}/tree`,
    method: 'get',
    params: listQuery
  })
}

export function getMenuInfo(menuId, scope) {
  const params = {}
  params.menuId = menuId
  return request({
    url: `/kd_manage/menu/${scope}/info`,
    method: 'get',
    params: params
  })
}

export function addMenu(data, scope) {
  return request({
    url: `/kd_manage/menu/${scope}/add`,
    method: 'post',
    data: data
  })
}
export function delMenu(menuId, scope) {
  const params = { menuId }
  return request({
    url: `/kd_manage/menu/${scope}/delete`,
    method: 'post',
    params: params
  })
}

export function updateMenu(id, data, scope) {
  data.id = id
  return request({
    url: `/kd_manage/menu/${scope}/edit`,
    method: 'post',
    data: data
  })
}
